<?php
  require_once('includes/db.php');
  $users = fetchAll('users');
  //pr($_SERVER);
  $url = $_SERVER['PHP_SELF'];
?>
<link href="css/form.css" rel="stylesheet" type="text/css" />

<table  border="1" cellpadding="0" cellspacing="0" width="80%" align="center">
  <thead>
    <tr>
      <th>#id</th>
      <th>Name</th>
      <th>Email</th>
      <th>Created Date</th>
      <th>Modify Date</th>
      <th>Status</th>
    </tr>
  </thead>
  <tbody>
<?php
  $i = 1;
  while($user = mysql_fetch_assoc($users))
  {
    $color = ($i++ %2==0)?'lightyellow':'lightgreen';
    $id = $user['id'];
    $email = $user['email'];
    $c_date = date('d-M-Y h:i:s a l',strtotime($user['created_date']));
    $m_date = date('d-M-Y h:i:s a l',strtotime($user['modify_date']));
    $status = showStatus($user['status'],$url);

?>
    <tr style="background-color:<?=$color?>">
      <td ><a target="_blank" href="update_user.php?id=<?=$id?>"><?=$id?></a></td>
      <td ><?=$user['name']?></td>
      <td ><a href="mailto:<?=$email?>">
      <?=$email?></a></td>
      <td ><?=$c_date?></td>
      <td ><?=$m_date?></td>
      <td ><?=$status?></a></td>
    </tr>
    <!---
    <tr style="background-color:<?=$color?>">
      <td ><a target="_blank" href="update_user.php?id=<?=$user['id']?>"><?=$user['id']?></a></td>
      <td ><?=$user['name']?></td>
      <td ><a href="mailto:<?=$user['email']?>"><?=$user['email']?></a></td>
      <td ><?=date('d-M-Y h:i:s a l',strtotime($user['created_date']))?></td>
      <td ><?=date('d-M-Y h:i:s a l',strtotime($user['modify_date']))?></td>
      <td ><a href="<?=$_SERVER['PHP_SELF']?>?id=<?=$user['id']?>&status=<?=showStatus($user['status'])?>"><?=showStatus($user['status'])?></td>
    </tr> --->


<?php
  }
?>

  </tbody>
</table>
